package com.uinnova.product.eam.service.impl;

import com.uinnova.product.eam.comm.model.OceanProject;
import com.uinnova.product.eam.comm.model.VcDiagramEle;
import com.uinnova.product.eam.db.OceanProjectDao;
import com.uinnova.product.eam.db.VcDiagramEleDao;
import com.uinnova.product.eam.service.OceanProjectService;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Log4j2
public class OceanProjectSvcImpl implements OceanProjectService {

    @Resource
    private OceanProjectDao oceanProjectDao;

    @Override
    public void saveBatch(List<OceanProject> oceanProjectList) {
        oceanProjectDao.saveBatch(oceanProjectList);
    }

    @Override
    public OceanProject selectLastOne() {
        return oceanProjectDao.selectLastOne();
    }

    @Override
    public void deleteAll() {
        oceanProjectDao.deleteAll();
    }

    @Transactional
    @Override
    public void deleteAndSave(List<OceanProject> oceanProjects) {
        oceanProjectDao.deleteAll();
        oceanProjectDao.saveBatch(oceanProjects);
    }
}
